package com.wuwei.elearning.question.controller;

import com.wuwei.elearning.utils.result.Result;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuwei.elearning.question.domain.ChangedLog;
import com.wuwei.elearning.question.service.ChangedLogService;

import java.util.List;
/**
 * <p>
 * 修改记录日志表 前端控制器
 * </p>
 *
 * @author wuwei
 * @since 2025-09-18
 */
@CrossOrigin
@RestController
@RequestMapping("/easy2learn/changedLog")
public class ChangedLogController {

    @Autowired
    private ChangedLogService changedLogService;


    /**
     * 分页查询数据
     *
     * @param current 当前页
     * @param size 每页显示条数
     * @return 分页查询结果
     */
    @GetMapping("/page")
    public Result<Page<ChangedLog>> page(
            @RequestParam(defaultValue = "1") Integer current,
            @RequestParam(defaultValue = "10") Integer size) {
        Page<ChangedLog> page = changedLogService.page(new Page<>(current, size));
        return Result.ok(page);
    }

    /**
     * 查询所有数据
     *
     * @return 查询结果列表
     */
    @GetMapping("/list")
    public Result<List<ChangedLog>> list() {
        List<ChangedLog> list = changedLogService.list();
        return Result.ok(list);
    }
}